if (!navigator) navigator = {};
if (!navigator.geolocation) {
	(function () {
		var geolocation = {};
	
		var returnError = -1; // no error
		var position = {
			coords: {
				latitude: "51.478389",
				longitude: "-0.010471"
			} // London
		};
	
		geolocation.UNKNOWN_ERROR = 0;
		geolocation.PERMISSION_DENIED = 1;
		geolocation.POSITION_UNAVAILABLE = 2;
		geolocation.TIMEOUT = 3;
	
		geolocation.getCurrentPosition = function (onSuccess, onError, options) {
			if (typeof onSuccess === 'function') {
				switch (returnError) {
					case geolocation.UNKNOWN_ERROR:
					    onError({
							code: returnError,
							message: 'unknown error'
						});
						break;
					case geolocation.PERMISSION_DENIED:
					    onError({
							code: returnError,
							message: 'permission denied'
						});
						break;
					case geolocation.POSITION_UNAVAILABLE:
					    onError({
							code: returnError,
							message: 'position unavailable'
						});
						break;
					case geolocation.TIMEOUT:
					    onError({
							code: returnError,
							message: 'timeout'
						});
						break;
					default: 
						onSuccess(position);
				}
			} else if (typeof onError === 'function') {
				onError({
					code: geolocation.UNKNOWN_ERROR,
					message: 'no success callback'
				});
			}
		};
	
		navigator.geolocation = geolocation;
	}) ();
}